home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / progjour / 1991 / 06 / bingo.asm next >
Assembly Source File  |  1991-07-28  |  3KB  |  83 lines

  1. ;***********************************************************************
  2. ;                              BINGO.ASM                               *
  3. ;   BINGO.COM is a trivial TSR to be used only for checking whether    *
  4. ; DOS is testing for a calendar update during command-line input       *
  5. ; waits.  If automatic calendar updating is occurring, running BINGO   *
  6. ; will return the DOS prompt followed by a line feed and the message   *
  7. ; "Bingo" - the cursor will move to the following line (in the column  *
  8. ; following the "o").  If this occurs, BINGO will have removed itself  *
  9. ; from memory.                                                         *
  10. ;   If BINGO is run under a DOS shell that does not support automatic  *
  11. ; calendar updating, only the DOS prompt will return. Remove BINGO     *
  12. ; from memory by immediately running DEBING.                           *
  13. ;======================================================================*
  14. ;                Written by M. L. Lesser, July 4, 1991                 *
  15. ;  Assembled with TASM v 2.5 and linked with TLINK v 4.0, switch "/t"  *
  16. ;***********************************************************************
  17.  
  18. VECTOR  EQU     4*1AH
  19.  
  20. SHOWIT  MACRO   SYMBOL                  ;Use BIOS to display symbol
  21.         MOV     AX,0E00H+SYMBOL
  22.         INT     10H
  23. ENDM
  24.  
  25. CODE SEGMENT PARA PUBLIC 'CODE'
  26.         ASSUME CS:CODE, DS:CODE
  27.         ORG     100H
  28. BINGO   PROC NEAR
  29.         JMP SHORT START         ;Initializer
  30.         ALIGN   4
  31. OLDINT  DD      0               ;Save original INT 1AH vector
  32. NEWINT:         ;New INT 1ah intercept
  33.         OR      AH,AH           ;Check for "read timer"
  34.         JZ      US              ;It's for us
  35.         JMP     CS:OLDINT       ;Else continue with INT 1AH
  36. US:     PUSHF                   ;Simulate interrupt,
  37.         CALL    CS:OLDINT       ;Returning to next statemnt
  38.         STI
  39.         PUSH    BP              ;Insurance, for some video adapters
  40.         PUSH    AX              ;AX and ES are used in following
  41.         PUSH    ES              ;  portion of NEWINT
  42.         XOR     AX,AX           ;Restore original interrupt vector
  43.         MOV     ES,AX
  44.         MOV     AX,WORD PTR CS:OLDINT
  45.         MOV     ES:[VECTOR],AX
  46.         MOV     AX,WORD PTR CS:OLDINT + 2
  47.         MOV     ES:[VECTOR+2],AX
  48.         SHOWIT  0AH             ;;Line feed
  49. IRPC    LETTER,Bingo
  50.         SHOWIT  '&LETTER'
  51. ENDM
  52.         SHOWIT  0AH
  53.         MOV     AX,CS           ;Release BINGO's memory
  54.         MOV     ES,AX
  55.         MOV     AH,49H
  56.         INT     21H
  57.         POP     ES
  58.         POP     AX
  59.         POP     BP
  60.         IRET                    ;Return to COMMAND.COM
  61.  
  62.         ALIGN 16
  63. START:                          ;Initialize interupt intercept
  64.         MOV     AX,ES:[2CH]     ;Environment segment
  65.         MOV     ES,AX
  66.         MOV     AH,49H          ;Release environment memory segment
  67.         INT     21H
  68.         MOV     AX,351AH        ;Save old INT 1AH vector
  69.         INT     21H
  70.         MOV     WORD PTR OLDINT,BX
  71.         MOV     WORD PTR OLDINT+2,ES
  72.         MOV     AX,251AH        ;Replace with vector to NEWINT
  73.         MOV     DX,OFFSET NEWINT
  74.         INT     21H
  75.         MOV     DX,OFFSET START         ;Release memory beyond START
  76.         MOV     CL,4
  77.         SHR     DX,CL                   ;Now in Paragraphs
  78.         MOV     AX,3100H
  79.         INT     21H
  80. BINGO   ENDP
  81. CODE    ENDS
  82.         END     BINGO
  83.